package br.gov.mi.corporativo.dominio.boundary.comum.banco;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

import br.gov.mi.corporativo.dominio.entidade.comum.Banco;

@Path("bancos")
public class BancoRestAdapter extends SpringBeanAutowiringSupport {


	@Autowired
	private BancoEndPoint service;
	
	@GET
	@Produces({MediaType.APPLICATION_JSON})
	public Iterable<Banco> recuperarTodos(){
		return service.recuperarTodos();
	}

	@GET
	@Path("/id/{id}")
	@Produces({MediaType.APPLICATION_JSON})
	public Banco recuperarPorId(@PathParam("id")Long id){
		return service.recuperarPorId(id);
	}
	
	@GET
	@Path("/nome/{nome}")
	@Produces({MediaType.APPLICATION_JSON})
	public List<Banco> recuperarPorNomeBanco(@PathParam("nome")String nome){
		return service.recuperarPorNomeBanco(nome);
	}
	
	@GET
	@Path("/sigla/{sigla}")
	@Produces({MediaType.APPLICATION_JSON})
	public Banco recuperarPorSigla(@PathParam("sigla")String sigla){
		return service.recuperarPorSigla(sigla);
	}
}
